# 骰子
# 创建一个Die 类，它包含一个名为sides 的属性，该属性的默认值为6。编写一个名为roll_die() 的方法，它打印位于1和骰子面数之间的随机数。创建一个6面的骰子再掷10次
from random import choice


class Die:

    def __init__(self, sides=6):
        self.sides = sides

    def roll_die(self):
        return choice(range(1, self.sides + 1))


die_6 = Die()
print("6 sides die, roll 10 times:")
for i in range(0, 10):
    print(die_6.roll_die())

die_10 = Die(10)
print("\n10 sides die, roll 10 times:")
for i in range(0, 10):
    print(die_10.roll_die())

die_100 = Die(100)
print("\n100 sides die, roll 10 times:")
for i in range(0, 10):
    print(die_100.roll_die())
